﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GurLoader;
using GurLoader.CommandLineOptions;
using Newtonsoft.Json;
using NUnit.Framework;

namespace GurLoaderWPF.Test.Preferences
{
    [TestFixture]
    public class SendImageOptionsTests
    {

        [Test]
        public void FilesContainedTest()
        {
            string desc = "Some description";
            string title = "Some title";
            string file = "C:\\images\\picture.jpg";

            var o = new SendImageOptions
            {
                Description = desc,
                Title = title,
                File = file
            };

            Assert.IsNotNull(o);
            Assert.AreEqual(desc, o.Description);
            Assert.AreEqual(title, o.Title);
            Assert.AreEqual(file, o.File);

            try
            {
                o.Validate();
            }
            catch (Exception)
            {
                Assert.Fail("Exception thrown durring validate.");
            }

        }

        [Test]
        [ExpectedException(typeof(Exception))]
        public void NullFilesTest()
        {
            string desc = "Some description";
            string title = "Some title";
            string file = null;

            var o = new SendImageOptions
            {
                Description = desc,
                Title = title,
                File = file
            };

            Assert.IsNotNull(o);
            Assert.AreEqual(desc, o.Description);
            Assert.AreEqual(title, o.Title);
            Assert.AreEqual(file, o.File);

            o.Validate();
        }

        [Test]
        [ExpectedException(typeof(Exception))]
        public void EmptyFilesTest()
        {
            string desc = "Some description";
            string title = "Some title";
            string file = string.Empty;

            var o = new SendImageOptions
            {
                Description = desc,
                Title = title,
                File = file
            };

            Assert.IsNotNull(o);
            Assert.AreEqual(desc, o.Description);
            Assert.AreEqual(title, o.Title);
            Assert.AreEqual(file, o.File);

            o.Validate();
        }
    }
}
